// src/config/router.js
import asyncLoadComponent from '../util/asyncLoadComponent'
// import Home from "../views/home"
// import DemoA from "../views/demoA"
// import DemoB from "../views/demoB"

// 将项目中的路由关系配置成数组
/**
 * path 匹配的路径，就是 Route 的 path
 * component 要渲染的组件（这里先采用上面导入方式，后面进行lazy()懒加载优化）
 * children 需要在当前页面渲染的子路由，也是个数组和外层路由结构基本一致
 */
const routerConfig = [{
    path: "/",
    component: asyncLoadComponent(() => import("../views/home")),
    children: [{
        path: "/demoA",
        component: asyncLoadComponent(() => import("../views/demoA"))
    }, {
        path: "/demoB",
        component: asyncLoadComponent(() => import("../views/demoB"))
    }]
}]

export default routerConfig
